package com.sicheng.metadata.se.exp.first;

import java.util.Arrays;

/**
 * @author zsc
 * @version 1.0
 * @date 2021/9/9 21:08
 */
public class FindMinInArr {
    public static void main(String[] args) {
        int[] arr = {3, 9, 12, -9};
        System.out.println("最小值:" + findMinInArr(arr));
    }

    public static int findMinInArr(int[] arr) {
        if (arr == null || arr.length == 0)
            throw new RuntimeException("数组不成立");
        return Arrays.stream(arr).min().getAsInt();
    }
}
